package com.anji.hyperneat.onlinereinforcement.trainingbank;


public class TrainingSequence {
	public TrainingSample[] sequence;
	
	public TrainingSequence(TrainingSample[] sequence) {
		this.sequence = sequence;
	}
	
	public void apply() {
		for (TrainingSample sample : sequence) {
			sample.applyToNet();
		}
	}
	
	public float applyAndGetSqErr() {
		float err = 0;
		for (TrainingSample sample : sequence) {
			err += sample.applyToNetAndGetSqErr();
		}
		return err;
	}
	
	public int getNumSamples() {
		return sequence.length;
	}
	
	public String toString() {
		StringBuilder sb = new StringBuilder();
		for (TrainingSample sample : sequence) {
			sb.append(sample);
			sb.append("\n");
		}
		return sb.toString();
	}

}
